package com.danbay.cloud.device.entity;

import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.danbay.cloud.base.constants.Const;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 *
 * @author SJG
 * 2017/10/21
 * 中控
 */
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
@TableName("center_control")
public class CenterControl {

    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * 设备sn码（设备名）
     */
    private String name;

    private Long user;

    private Long contractInfo;

    private Long province;

    private Long city;

    private java.util.Date deviceTime;

    private Long area;

    private String address;

    private Long gateNum;

    private Long inGateNum;

    /**已激活设备门锁数量*/
    private Long activateGateNum;
    /**房间数量*/
    private Long roomNum;

    /**mac地址*/
    private String macAddress;

    /**设备版本*/
    private String version;

    /**
     * 设备id
     */
    private String deviceId;

    /**
     * 是否已删除
     */
    private String hasDelete;

    /**
     * 中控所在的网络IP地址,每次登录的时候会重新回去该字段
     */
    private String remoteAddr;

    /**
     * 中控所在的网络socket端口号
     * 该字段用于解决 中控异常离线后在90s内迅速上线时重新开一个socket线程与原先老线程冲突导致数据老是显示离线问题
     */
    private String remotePort;

    private String provider;

    private java.util.Date createTime;

    private String status;

    private String addstatus;

    /**
     * 是否在线
     * @return boolean
     */
    public boolean isOnline(){
        return Const.BOOL_STRING_FALSE.equals(getStatus());
    }
}
